package br.uff.busuffweb.contexto;

import br.uff.busuffweb.controller.CircuitoMB;
import br.uff.busuffweb.controller.ConfiguracaoMB;
import br.uff.busuffweb.controller.OnibusCircuitoMB;
import br.uff.busuffweb.controller.OnibusMB;
import br.uff.busuffweb.controller.ParadaCircuitoMB;
import br.uff.busuffweb.controller.ParadaMB;
import br.uff.busuffweb.controller.PontoCircuitoMB;
import br.uff.busuffweb.controller.PontoMB;
import br.uff.busuffweb.util.FabricaDeObjetos;
import br.uff.busuffweb.util.JPAUtil;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 *
 * @author jthiago
 */
public class ContextoAplicacao implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        FabricaDeObjetos.putObjetoUnico(new CircuitoMB());
        FabricaDeObjetos.putObjetoUnico(new ConfiguracaoMB());
        FabricaDeObjetos.putObjetoUnico(new OnibusCircuitoMB());
        FabricaDeObjetos.putObjetoUnico(new OnibusMB());
        FabricaDeObjetos.putObjetoUnico(new ParadaCircuitoMB());
        FabricaDeObjetos.putObjetoUnico(new ParadaMB());
        FabricaDeObjetos.putObjetoUnico(new PontoCircuitoMB());
        FabricaDeObjetos.putObjetoUnico(new PontoMB());
        
        JPAUtil.startUp();
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
    }
}
